﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" import="java.sql.*"%>
<%@ page import="ookweb.Conn"%>
<%@ page import="ookweb.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/ookweb/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>东方通登录</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="keywords" content="">
	<meta http-equiv="description" content="">
	<script src="<%=basePath%>js/jquery-1.5.1.min.js"  type="text/javascript" ></script>
<style type="text/css">
* {
	margin:0px;
	padding:0px; font-size:12px;color: #445d7b;
}
form{ margin-top:100px;}
h1{ font-size:14px;font-weight:bold}
input{color:#999999;line-height:16px; height:16px; border:0px solid; width:220px;}
.sub{padding:2px; width:70px; height:20px; }  
</style>

  </head>
  
  <body>
  
 <%
String strUserName=(String)request.getParameter("username");
String strPassword=(String)request.getParameter("password");

String message="";
if("".equals(strUserName) ||  strUserName==null || "".equals(strPassword) ||  strPassword==null){
 
}else{  

String dbuser = application.getInitParameter("dbuser");
String dbpass = application.getInitParameter("dbpass");
String dburl  = application.getInitParameter("dburl"); 
Conn con=new Conn(dbuser,dbpass,dburl);
        ResultSet rs=con.getRs("select mid from  web_member where username='"+strUserName+"' and userpass='"+strPassword+"'");
        if(rs.next()){
                session.setAttribute("ookweb_user_username",strUserName);
                session.setAttribute("ookweb_user_password",strPassword);
                session.setAttribute("ookweb_user_userid",rs.getString("mid"));
                response.sendRedirect(path+"/index.jsp");
        }else{
            message="你输入的用户名或密码错误.";   
        }
   
		
}
%> 
  
   <div align="center">
<form action="login.jsp" method="post" id="logfrm">
<table width="546" height="416" border="0" align="center" cellpadding="0" cellspacing="0" style="background:url(images/ss.gif) no-repeat"  >
    <tr>

    <td width="154" height="81" align="right" valign="bottom"></td>
    <td width="390" height="81" align="right"><table width="390" height="58" border="0" align="right">
      <tr>
      	<td width="170" height="47" rowspan="2" align="left" valign="bottom">
      	<a style=" display:block; margin:0px auto; width:40px; height:20px;" href="index.jsp"></a>      </td>
        <td width="220" height="24" align="center" valign="top"><a style=" display:block; margin:0px auto; cursor:pointer; width:60px; float:right; height:20px;" onClick="window.close();"></a></td>
      </tr>
      <tr>
        <td height="23" align="center" valign="bottom"><a style=" display:block; margin:0px auto; width:60px; height:20px;" href="register.jsp"></a></td>
      </tr>
    </table>      
    <h1>&nbsp;</h1></td> 
    </tr>
  <tr>
    <td width="154" height="106" align="right">:</td>
    <td width="390" height="106" align="left"><label></label></td>

    </tr>
  <tr>
    <td height="30" align="right">&nbsp;</td>
    <td height="30" align="left"><input type="text" name="username" id="username"  value=""/></td>
  </tr>
     <tr>
    <td height="54" align="right">&nbsp;</td>
    <td height="54" align="left" valign="bottom"><label>
    <input type="password" name="password" value="" id="password" />
    </label></td>
    </tr>
    
     <tr>
    <td height="137" colspan="2" align="center" valign="top"><table width="261" height="61" border="0" align="right">
      <tr>
        <td width="220" height="57" align="center" valign="bottom"><a id="logincmd" style=" display:block; margin:0px auto; width:60px; height:20px;" href="#"></a></td>
      </tr>
    </table></td>
    </tr>
   </table>
</form>
</div>
<script type="text/javascript">
$(function(){
  $("#logincmd").click(function(){
   var u=$("#username").attr("value");
   var p=$("#password").attr("value");
   if(u=='' || p==''){
  alert('请输入用户名或密码');
   }else{
    $("#logfrm").submit();
  }
  });
});
</script>
  </body>
</html>
